package day2;
import java.util.*;
/**
 * @author oldliu
 * @since 1.0
 */
public class ListTest {
    public static void main(String[] args) {
        List list=new ArrayList();
        list.add("大黄");
        list.add(Math.PI);
        list.add(3);
        list.add('d');
        list.add("你好");
        System.out.println(list.size());
        System.out.println(list);
        list.set(2,"徐大鹏");//覆盖
        list.add("大黄");
        list.add(2>1);
        System.out.println(list);
        //删除
        //1:根据位置删除,2:根据对象删除
        list.remove(3);
        System.out.println("删除后："+list);
        System.out.println(">>>>>>>");
        //get通过下标获得所有的元素
        for(int i=0;i<list.size();i++){
            Object obj=list.get(i);
            System.out.println((i+1)+":"+obj);
        }
        System.out.println(list.contains("大黄"));
    }
}
